<!DOCTYPE html>
<html lang="${lang}">
<head>
    <meta charset="UTF-8">
    <title>流程设计器</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta content="Johnny" name="author">

    <link rel="shortcut icon" href="${cdn}/favicon.ico">

    <%
    if (profile=="dev") {
    %>
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/platform/designer/css/designer.css" />
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/platform/designer/css/diagram-js.css" />
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/platform/designer/css/bpmn-embedded.css" />
    
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/jquery-ui/jquery-ui.css"/>
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/jquery-ui/jquery-ui.theme.css"/>
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/jquery-ui/jquery-ui.structure.css"/>
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/dhtmlx4/skins/dhx_web_lightblue/dhtmlx.css"/>
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assets/3rdpartyother/tipsy.css"/>
    <% } else { %>
    <link rel="stylesheet" href="${cdn}/static/skins/lightblue/assetsmin/platform/admin/designer.all.css?${productionVersion}" type="text/css">
    <% }%>

</head>
<body>
    <div class="wait">
        <div>
            <div><img src='${cdn}/static/skins/lightblue/images/loading.gif'></div>
            <div class="waitMsg"></div>
        </div>
    </div>

    <!-- MAIN CONTAINER -->

    <div id="maindiv"></div>

    <%
    if (profile=="dev") {
    %>
    <!-- BEGIN CORE PLUGINS -->
    <script src="${cdn}/static/jslib/jquery/jquery1.12.4.js" type="text/javascript"></script>
    <script src="${cdn}/static/jslib/jquery/jquery.tipsy.js"></script>
    <script src="${cdn}/static/jslib/3rdpartyother/json2.js"></script>
    <script src="${cdn}/static/jslib/3rdpartyother/jsonselect.min.js"></script>
    <script src="${cdn}/static/jslib/3rdpartyother/xml2json.js"></script>
    <script src="${cdn}/static/jslib/util/common.js"></script>
    <script src="${cdn}/static/jslib/jquery-ui/jquery-ui.js" type="text/javascript"></script>
    <script src="${cdn}/static/jslib/dhtmlx4/dhtmlx.js"></script>
    <script src="${cdn}/static/jslib/dhtmlx4/ext/dhxgrid.js"></script>
    <script src="${cdn}/static/jslib/dhtmlx4/ext/dhxwindow.js"></script>
    <script src="${cdn}/static/jslib/dhtmlx4/ext/excell_types.js"></script>
    <script src="${cdn}/static/jslib/dhtmlx4/ext/validator.js"></script>
    <script src="${cdn}/static/jslib/dhtmlx4/ext/dhx_i18n_${lang}.js"></script>
    <!-- END CORE PLUGINS -->

    <!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
    <script src="${cdn}/static/jsplatform/admin/designer/flow_style.js"></script>

    <script src="${cdn}/static/jsplatform/admin/designer/flowprop_elem_i18n_${lang}.js"></script>
    <script src="${cdn}/static/jsplatform/admin/designer/flow_i18n_${lang}.js"></script>

    <script src="${cdn}/static/jsplatform/admin/designer/flowprop_elem.js"></script>
    <script src="${cdn}/static/jsplatform/admin/designer/flowprop_propfunc.js"></script>
    <script src="${cdn}/static/jsplatform/admin/designer/flow.js"></script>

    <script src="${cdn}/static/jsplatform/admin/designer/pichange.js"></script>

    <% } else { %>
    <script src="${cdn}/static/jsmin/platform/admin/designer/designer_import.all.js?${productionVersion}" type="text/javascript"></script>
    <script src="${cdn}/static/jsplatform/admin/designer/flow_style.js?${productionVersion}"></script>
    <script src="${cdn}/static/jsmin/platform/admin/designer/designer_i18n_${lang}.all.js?${productionVersion}" type="text/javascript"></script>
    <script src="${cdn}/static/jsmin/platform/admin/designer/designer_flow_pichange.all.js?${productionVersion}" type="text/javascript"></script>
    <% }%>

    <script>

        //disable context menu
        document.oncontextmenu = function(){return false;};
        //window.onbeforeunload = fl_checkClose;

        //init vars
        ctxpath = "/admin";	//context path for this app
        bpmeCtx = "/bpmp-engine";	//context path for bpm engine webapp
        resloc = "${cdn}";	//resloc for this app

        //dhx constants
        dhtmlx.image_path = resloc + '/static/skins/lightblue/assets/dhtmlx4/imgs/';
        dhx_skin = "dhx_web";
        dhx_theme = "lightblue";

        var flvar = {};
        flvar.lang = '${lang}';
        flvar.imagepath = resloc + '/static/skins/lightblue/images/platform/designer/';
        flvar.iconpath = flvar.imagepath;
        flvar.iconpath_flowcanvas = flvar.imagepath + "flowcanvas/";
        flvar.fmdCtx = "${fmdCtx}";
        flvar.flowRes = 'bpd';
        flvar.flowid = "${flowid}";
        flvar.piEid = "${piEid}";
        flvar.isEditor = ${isEditor};
        flvar.profile ="${profile}";
        flvar.layoutPattern="LaneBased";
        flvar.restCtx = "/bpmp-engine/api/v1";
        flvar.bpmeRest = "/bpmp-engine/api/v1/engine";
        flvar.url_viewbpd = ctxpath + "/view/process/view/";
        flvar.url_piinfo = flvar.bpmeRest + "/process/pi/";
        flvar.url_help = resloc + "/static/html/help/platform/designer/userguide.html";
        flvar.url_get_infoforchange = flvar.bpmeRest + '/process/pi/infoForChange/';
        flvar.url_save = flvar.bpmeRest + '/process/pi/saveDynamicChange/';

        //modules
        flvar.moduleRoot = '${modulesPath}';
        flvar.activityModules = ${activityModules};
        flvar.eventModules = ${eventModules};
        flvar.gatewayModules = ${gatewayModules};
        flvar.layoutModules = ${layoutModules};
        flvar.transitionModules = ${transitionModules};
        flvar.miscModules = ${miscModules};

        function doneValidation(validationPrepare, waitValidation, callSave) {
            var vpds = validationPrepare();
            var promiseCmds = "$.when(fl_waitmsg('"+fmd_i18n_msg_validating+"')";
            if (vpds && vpds.length) {
                for (var i in vpds) {
                    promiseCmds += ",vpds["+i+"]";
                }
            }
            promiseCmds += ").done(waitValidation)"+
                ".done(function(){return callShowValidationInfo("+(callSave?"true":"false")+")})"+
                ".done(fl_waitend)";
            //执行
            eval(promiseCmds);
        }
    </script>

    <%
    if (profile=="dev") {
    %>
    <script src="${cdn}/static/jsplatform/admin/designer/flowmain.js"></script>
    <% } else { %>
    <script src="${cdn}/static/jsmin/platform/admin/designer/designer_flowmain.all.js?${productionVersion}" type="text/javascript"></script>
    <script src="${cdn}/static/jsmin/platform/admin/designer/designer_elems_i18n.all.js?${productionVersion}" type="text/javascript"></script>
    <script src="${cdn}/static/jsmin/platform/admin/designer/designer_elems.all.js?${productionVersion}" type="text/javascript"></script>
    <% }%>
</body>
</html>